Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.1K
Views
Can't instantiate "scene object" [Unity Mirror Multiplayer]

I am trying to instantiate an object that already exists in the scene so that I can enlarge it and "zoom" in on it, but when I play the game and hover over an object, instead of showing the zoomed card, this error shows up:

Card1(Clone)(Clone) has already spawned. Don't call Instantiate for NetworkIdentities that were in the scene since the beginning (aka scene objects). Otherwise the client won't know which object to use for a SpawnSceneObject message.

NOTE: I am following a tutorial for a 2D Unity Card game with mirror (2019.2.15f1), and I am using a different version of Unity (2020.1.0f1).

First, I am instantiating objects into my game with this script, which never throws any errors.

[Command]
public void CmdDealCards()
{
    for (int i = 0; i < 4; i++)
    {
        GameObject card = Instantiate(playerDeck[Random.Range(0, playerDeck.Count)], new Vector2(0, 0), Quaternion.identity);
        NetworkServer.Spawn(card, connectionToClient);
        RpcShowCard(card, "Dealt");
    }
}

The problem comes when I try to instantiate these objects again later, here:

public void OnHoverEnter()
{
    zoomCard = Instantiate(gameObject, new Vector2(Input.mousePosition.x, 540), Quaternion.identity);
    zoomCard.transform.SetParent(Canvas.transform, true);
    zoomCard.layer = LayerMask.NameToLayer("Zoom");

    RectTransform rect = zoomCard.GetComponent<RectTransform>();
    rect.sizeDelta = new Vector2(240, 354);
}
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I know this is a really late answer, but I came across it while running into the same issue, and maybe in the future, someone will do the same as me, so:

What you've done is attached the wrong prefab to your CardZoom script in the Inspector. Image of Inspector with Zoom Card attached

What I did, and presumably you also, was to attach Card1 here, which is where it was failing to duplicate the NetworkIdentity

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!